package com.zijie.system.controller.system;

import cn.dev33.satoken.annotation.SaIgnore;
import com.zijie.common.core.config.ZiJieConfig;
import com.zijie.common.core.utils.StringUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.view.RedirectView;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * 首页
 *
 * @author Lion Li
 */
@RequiredArgsConstructor
@RestController
public class SysIndexController {

    /**
     * 系统基础配置
     */
    private final ZiJieConfig zijieConfig;

    /**
     * 访问首页，提示语
     */
    @SaIgnore
    @GetMapping("/")
    public RedirectView index() throws UnknownHostException {

        // 动态获取本机IP地址
        String ipAddress = InetAddress.getLocalHost().getHostAddress();
        return new RedirectView("https://" + ipAddress + ":80");
    }
}
